package com.easthome.auth.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easthome.auth.service.SysDeptService;
import com.easthome.auth.service.SysLoginLogService;
import com.easthome.common.result.Result;
import com.easthome.model.system.SysDept;
import com.easthome.model.system.SysLoginLog;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: 朱敦宇
 * @time: 2024/4/24 21:50
 */
@RestController
@RequestMapping("/admin/system/sysLoginLog")
public class SysLoginLogController {
    @Autowired
    private SysLoginLogService service;

    @ApiOperation("登陆日志分页查询")
    @GetMapping("/{page}/{limit}")
    public Result findByPage(@PathVariable Long page,
                             @PathVariable Long limit,
                             SysLoginLog sysLoginLog){

        Page<SysLoginLog> deptPage = new Page<>(page,limit);
        LambdaQueryWrapper<SysLoginLog> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(SysLoginLog::getCreateTime);
        service.page(deptPage,queryWrapper);
        return Result.ok(deptPage);
    }
}
